<?php
/**
 * Created by PhpStorm.
 * User: Cui Jun
 * Date: 2016-10-25
 * Time: 11:40
 * To change this template use File | Settings | File Templates.
 */
error_reporting(0);
set_time_limit(0);
date_default_timezone_set('Asia/Shanghai');
header("Content-type: text/html; charset=utf-8");
$database = require_once '../../common/config/main-local.php';
$database = $database['components']['db'];
$pdo = new PDO($database['dsn'],$database['username'],$database['password']);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec('set names '.$database['charset']);

//清除速率限制表
if($argv[1] == 'rate'){
    if($pdo->exec("TRUNCATE TABLE ".$database['tablePrefix']."rate_app") === false){
        print_r($pdo->errorInfo());exit;
    }
}
